
require("debugtools")

local socket = require("socket")

local host = host or "127.0.0.1"
local port = port or 15260
local max  = max  or 10

if arg ~= nil then
	host = arg[1] or host
	port = arg[2] or port
	max  = arg[3] or max
end

local connect = assert(socket.connect(host, port))
connect:settimeout(0)

local str
while true do
	str = connect:receive()
	if str ~= nil then
		printf("-- receive:%s", str)
	end
	print("$ ")
	str = io.read()
	connect:send(str .. '\n')
end
